package file01;

import java.io.File;

public class ListFilesDemo {
    public static void main(String[] args) {
        File dir = new File(".");//当前目录所有子项
        if (dir.isDirectory()){// 判断是否为目录
            System.out.println(dir.getName()+"是一个目录");
        }
        File[] subs = dir.listFiles();
        System.out.println(subs.length+"个子项");
        for (File sub : subs){
            System.out.println(sub.getName());
        }
    }
}
